package com.coreJava.设计模式.JDK动态代理;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * 作者: LCG
 * 日期: 2019/9/4 17:01
 * 描述:
 */
public class MyInvocationHandler implements InvocationHandler {

    private Object object=new DongTaiInterfaceImpl();

    public MyInvocationHandler(Object object) {
        this.object = object;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        System.out.println("=======执行之前运行代码=====");
        Object invoke = method.invoke(object, args);
        System.out.println("=======执行之后运行代码=====");

        return invoke;
    }
}
